//  MineViewController.m
//  dhfsAPP
//
//  Created by Devil on 2017/7/31.
//  Copyright © 2017年 Devil. All rights reserved.
//

#import "MineViewController.h"
#import "fsapp-Swift.h"
#import <AdSupport/AdSupport.h>
@interface MineViewController ()

@property(strong,nonatomic)MineView *mineView;

@end

@implementation MineViewController

#pragma mark - 懒加载
-(MineView *)mineView{
    if (!_mineView) {
        if (![[NSUserDefaults standardUserDefaults] objectForKey:@"Cookie"])
        {
            [[NSUserDefaults standardUserDefaults] setObject:@"" forKey:@"img"];
        }
        _mineView = [[MineView alloc] initWithFrame:CGRectMake(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT)];
        
        _mineView.mineViewDelegate = self;
    }
    
    return _mineView;
}

- (void)viewDidLoad {
    [super viewDidLoad];

   
}

- (void)viewWillAppear:(BOOL)animated{
    [super viewWillAppear:animated];
    [self.view addSubview:self.mineView];
    self.navigationController.navigationBarHidden = YES;
    NSLog(@"%@",[[NSUserDefaults standardUserDefaults] objectForKey:@"Cookie"]);
    NSLog(@"%@",[[NSUserDefaults standardUserDefaults] objectForKey:@"idfa"]);
    NSLog(@"%@",[[NSUserDefaults standardUserDefaults] objectForKey:@"name"]);
    if (![[NSUserDefaults standardUserDefaults] objectForKey:@"Cookie"] ||  [[NSString stringWithFormat:@"%@",[[NSUserDefaults standardUserDefaults] objectForKey:@"Cookie"]] isEqualToString:@"(null)"])
    {
       [self.mineView isNotLogin];
    }
    else
    {
        [self.mineView isLogin];
    }
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

#pragma mark - MineViewDelegate实现
-(void)pushVC:(UIViewController *)vc{
   // [self.navigationController.navigationBar.bar]
    [vc setHidesBottomBarWhenPushed:YES];
   UINavigationController *nav = [[UINavigationController alloc] initWithRootViewController:vc];
    //self.navigationController.navigationBarHidden = NO;
    nav.navigationController.navigationBarHidden = YES;
  //  [self.navigationController pushViewController: nav animated:true];
    //[ickImageViewController release];
   
    [self presentViewController:nav animated:YES completion:nil];
}
-(void)backVC{
    
    
    LoadViewController *ivc = [[LoadViewController  alloc] init];
    UINavigationController *nav = [[UINavigationController alloc] initWithRootViewController:ivc.CusTomTabBar];
    [self presentViewController:ivc.CusTomTabBar animated:NO completion:nil];
    
    // [self.presentedViewController:ivc animated:YES completion:nil];
    //[self dismissViewControllerAnimated:YES completion:nil];
}

-(void)login:(UIViewController *)vc{
    [self presentViewController:vc animated:YES completion:nil];
}

-(void)reloadUI{
    [self viewWillAppear:YES];
}

#pragma mark - 禁止屏幕旋转
-(BOOL)shouldAutorotate{
    return NO;
}


@end
